using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DALTMClient.WSDL;

namespace DALTMClient
{
    public partial class frmAddtoMessengerList : Form
    {
        AluMessenger chat = new AluMessenger();
        public frmAddtoMessengerList()
        {
            InitializeComponent();
        }

        private void btnNext_Click(object sender, EventArgs e)
        {
            try
            {
                if (chat.AddFriend(frmAluMain.UserName, frmAddFriend.FriendUser, cboGroups.Text))
                {
                    frmAluMain.CheckAdd = true;
                    label1.Text = "Add Friend is successfully !";
                    cboGroups.Visible = false;
                    btnCancel.Text = "&Finish";
                    btnNext.Visible = false;
                    lblUser.Visible = false;
                    label4.Visible = false;
                }
                else
                    MessageBox.Show("Add Friend is not successful !", "Alu! Messenger");
            }
            catch
            {
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmAddtoMessengerList_Load(object sender, EventArgs e)
        {
            try
            {
                lblUser.Text = frmAluMain.UserName;
                DataTable dt = new DataTable();
                dt = chat.GetGroups(frmAluMain.UserName);
                if (dt.Rows.Count > 0)
                    foreach (DataRow row in dt.Rows)
                        cboGroups.Items.Add(row[0]);
            }
            catch { }
        }
    }
}